package com.gitee.ice1938.module.admin.app.manage.appownerinfo;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * AppOwnerInfoServiceImpl
 * 
 * 
 * @author ice1938@qq.com  2019-11-29 14:17:00 
 *
 */
@Service
@Transactional
public class AppOwnerInfoServiceImpl implements AppOwnerInfoService {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = LoggerFactory.getLogger(AppOwnerInfoServiceImpl.class);

	@Autowired
	private AppOwnerInfoRepository appOwnerInfoRepository;
	
	@Override
    public Page<AppOwnerInfoEntity> findAppOwnerInfoData(Map<String, Object> param, Pageable pageable, Order order) {
	    return appOwnerInfoRepository.findData(param,pageable,order);
    }


	@Override
    public int insertAppOwnerInfo(AppOwnerInfoEntity data,String userLoginName) {
	    // TODO Auto-generated method stub
		if(data.getIntendantId()==null){
			data.setIntendantId(defIntendantId);
		}
		data.setOwnerUuid(UUID.randomUUID().toString());
	    return appOwnerInfoRepository.insert(data,userLoginName);
    }


	@Override
    public int updateAppOwnerInfo(AppOwnerInfoEntity data,String userLoginName) {
		if(data.getIntendantId()==null){
			data.setIntendantId(defIntendantId);
		}
	    return appOwnerInfoRepository.update(data,userLoginName);
    }

	@Override
    public int disableAppOwnerInfo(String ownerMd5, Boolean disable,String userLoginName) {
	    // TODO Auto-generated method stub
	    return appOwnerInfoRepository.disable(ownerMd5,disable,userLoginName);
    }

	@Override
    public int deleteAppOwnerInfo(String ownerMd5) {
	    // TODO Auto-generated method stub
	    return appOwnerInfoRepository.delete(ownerMd5);
    }
	@Override
    public int deleteAppOwnerInfoByIds(List<String> ids){
	    // TODO Auto-generated method stub
	    return appOwnerInfoRepository.delete(ids);
	}


	@Override
    public AppOwnerInfoEntity findOwnerInfo(String id) {
	    return appOwnerInfoRepository.findOne(id);
    }


}
